//
//  SLUnlockAlertView.m
//  SlockApp
//
//  Created by 凯朱 on 2024/7/23.
//

#import "SLUnlockAlertView.h"
@interface SLUnlockAlertView()<UIGestureRecognizerDelegate>

@end
@implementation SLUnlockAlertView
-(void)awakeFromNib{
    [super awakeFromNib];
    _bgView.layer.cornerRadius = 20;
    _bgView.layer.masksToBounds = YES;
    
    kWeakSelf(self);
//    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id  _Nonnull sender) {
//        if (weakself.btnBlock) {
//            weakself.btnBlock(1, weakself.model);
//        }
//    }];
//    _bgView.userInteractionEnabled = YES;
//    [_bgView addGestureRecognizer:tap];
//    
//    self.userInteractionEnabled = YES;
//    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewTapped:)];
//    tapGesture.delegate = self;
//    [self addGestureRecognizer:tapGesture];
}

// 处理点击事件的方法
- (void)viewTapped:(UITapGestureRecognizer *)gesture {
    
}

//// 实现 UIGestureRecognizerDelegate 协议方法,允许子视图响应点击事件
//- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
//    if (touch.view == _bgView) {
//        // 如果点击的是子视图 icon,则允许其响应点击事件
//        return YES;
//    }
//    // 如果点击的是 UIView 本身,则处理点击事件
//    [self removeFromSuperview];
//    return NO;
//}

-(void)setModel:(SLLockModel *)model{
    _model = model;
    
}

-(void)setStyle:(NSInteger)style{
    if (style == 1) {
        _tipLbl.text = kLocalString(@"Unlock via bluetooth");
        _leftIcon.image = [UIImage imageNamed:@"unlock_blue"];
    }else{
        _tipLbl.text = kLocalString(@"Unlock via bridge");
        _leftIcon.image = [UIImage imageNamed:@"unlock_wifi"];
    }
}

@end
